q = {"zero":0, "one":1, "two":2, "three":3, "four":4, "five":5, "six":6, "seven":7, "eight":8, "nine":9}
w= input ()
e = w. split(" ")
r=""
t = [2]
n=1001
for i in range (100, n+1):
    z = 0
    for j in t:
        if i %j==0:
            z=1
    if z==0:
        t. append (i)
for i in range(len(e)):
    l = e[i]
    r = r + str(q[l])
r= int (r)
if r in t:
    print (r)
else:
    t. append (r)
    print (sorted (t))
    for i in range(len(t)):
        if r in t:
            print (t [i])
